package o;

import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import com.huawei.cloudservice.CloudAccount;
import com.huawei.cloudservice.CloudRequestHandler;
import com.huawei.hwid.core.datatype.UserInfo;
import o.cbb.j;
import o.cce.e;
import o.cch.d;

public class ccf {
    private Handler ʼ = new Handler(this) {
        final /* synthetic */ ccf ˎ;

        {
            this.ˎ = r1;
        }

        public void handleMessage(Message message) {
            switch (message.what) {
                case 0:
                    this.ˎ.ॱ();
                    return;
                default:
                    return;
            }
        }
    };
    private cca ˊ;
    private CloudAccount ˋ;
    private String ˎ;
    private String ˏ;
    private UserInfo ॱ;
    private Context ᐝ;

    public ccf(cca o_cca) {
        this.ˊ = o_cca;
        this.ᐝ = bqy.ˋ().ˏ();
    }

    public void ॱ(String str, String str2) {
        if (TextUtils.isEmpty(str2)) {
            bqx.ˏ("UserInfoManager", "updateUserInfo nickname is null , updateUserInfo failed");
            return;
        }
        this.ˏ = str2;
        if (this.ˋ == null) {
            this.ˋ = eos.ˊ();
        }
        if (this.ˋ == null) {
            bqx.ˏ("UserInfoManager", "CloudAccount of current is null , updateHeadPic failed");
            return;
        }
        this.ॱ = new UserInfo();
        this.ॱ.setNickName(str2);
        if (TextUtils.isEmpty(str)) {
            ॱ();
        } else {
            ˎ(str);
        }
    }

    private void ˎ(String str) {
        CloudRequestHandler o_cce = new cce();
        o_cce.ˎ(new e(this) {
            final /* synthetic */ ccf ˎ;

            {
                this.ˎ = r1;
            }

            public void ˊ(String str) {
                this.ˎ.ˎ = str;
                this.ˎ.ʼ.sendEmptyMessage(0);
            }

            public void ˎ() {
                evk.ˏ(this.ˎ.ᐝ.getResources().getString(j.ˏ));
                if (this.ˎ.ˊ != null) {
                    this.ˎ.ˊ.ˎ(0);
                }
            }
        });
        this.ˋ.updateHeadPicture(this.ᐝ, str, o_cce);
    }

    private void ॱ() {
        CloudRequestHandler o_cch = new cch();
        o_cch.ˏ(new d(this) {
            final /* synthetic */ ccf ˊ;

            {
                this.ˊ = r1;
            }

            public void ˎ() {
                evk.ˏ(this.ˊ.ᐝ.getResources().getString(j.ˏˎ));
                if (this.ˊ.ˊ != null) {
                    this.ˊ.ˊ.ˎ(this.ˊ.ˎ, this.ˊ.ˏ);
                }
            }

            public void ˎ(int i) {
                if (i != 70005003) {
                    evk.ˏ(this.ˊ.ᐝ.getResources().getString(j.ˏ));
                }
                if (this.ˊ.ˊ != null) {
                    this.ˊ.ˊ.ˎ(i);
                }
            }
        });
        this.ˋ.updateUserInfo(this.ᐝ, this.ॱ, o_cch);
    }
}
